package cn.yitun.chat.yitunserverimapicore.business.chat.service;

import cn.yitun.chat.yituncommonmessage.result.ResultMessage;
import cn.yitun.chat.yitunservercommonlib.crud.yitun.CrudService;
import cn.yitun.chat.yitunservercommonlib.dataentity.data.base.chat.ChatItem;
import cn.yitun.chat.yitunservercommonlib.dataentity.data.base.chat.UserChatHistoryDto;
import cn.yitun.chat.yitunservercommonlib.dataentity.data.base.chat.UserOfflineCount;
import cn.yitun.chat.yitunservercommonlib.dataentity.data.core.chat.UserChatHistory;
import cn.yitun.chat.yitunservercommonlib.dataentity.dto.userchat.UserChatContentDto;
import cn.yitun.chat.yitunservercommonlib.dataentity.po.userchat.UserChatContentInfo;
import cn.yitun.chat.yitunservercommonlib.dataentity.vo.userchat.UserChatContentVo;

import java.util.List;

/**
 * 
 * Description <br>
 * Date 2016-08-23 11:20:14<br>
 *
 * @author yitun<br>
 * @version 1.1
 */
public interface UserChatHistoryService
		extends CrudService<UserChatContentDto, UserChatContentInfo, UserChatContentVo>{


	/**
	 * 根据记录表id查询用户聊天记录（上翻，下拉方式的）
	 * 
	 * @param query
	 * @return
	 */
	ResultMessage getUserChatLogListByStartId(UserChatContentDto query);

	/**
	 * 根据消息id查询用户聊天记录（上翻，下拉方式的）
	 * 
	 * @param query
	 * @return
	 */
	ResultMessage getUserChatLogListByStartMessageKey(UserChatContentDto query);
	/**
	 * 分页查询聊天记录
	 * 
	 * @param chatQuery
	 * @return
	 */
	ResultMessage queryUserChatLogList(UserChatContentDto chatQuery);

	List<UserChatHistory> queryUserChatContentList(UserChatHistoryDto query);

	/**
	 * 
	 * Date 2019-02-17 19:16:27<br>
	 * Description 获取离线消息信息
	 * 
	 * @param receiveUserId
	 * @return
	 * @author yitun<br>
	 * @version 1.1
	 */
	List<Long> getOfflineUserIdList(Long receiveUserId);

	/**
	 * 
	 * Date 2019-02-17 19:16:00<br>
	 * Description 更新消息为已读
	 * 
	 * @param receiveUserId
	 * @param sendUserId
	 * @author yitun<br>
	 * @version 1.1
	 */
	void updateUserOfflineMessageToRead(Long receiveUserId, Long sendUserId, Long contentId, Long messageId);

	/**
	 * 
	 * Date 2019-02-17 19:15:40<br>
	 * Description 获取离线消息组合数量<br>
	 * 数据结构：[{"sendUserId":"110","count":100},{"sendUserId":"120","count":12},{
	 * "sendUserId":"119","count":19}]
	 * 
	 * @param query
	 * @return
	 * @author yitun<br>
	 * @version 1.1
	 */
	List<UserOfflineCount> getOfflineCountList(UserChatContentDto query);

	/**
	 * 
	 * Date 2019-02-17 19:14:59<br>
	 * Description 获取指定相送离线消息的数量组合数量<br>
	 * 数据结构：[{"sendUserId":"110","count":100},{"sendUserId":"120","count":12},{
	 * "sendUserId":"119","count":19}]
	 * 
	 * @param query
	 * @return
	 * @author yitun<br>
	 * @version 1.1
	 */
	List<UserOfflineCount> getOfflineCountListBySendUserIds(UserChatContentDto query);

	void addUserChatHistory(
			boolean isSend,
			Long sendUserId,
			Long receiveUserId,
			Long messageId,
			List<ChatItem> chatItemList);

	/**
	 * 获取未读 计数
	 * @param query
	 * @return
	 */
	ResultMessage queryUserChatUnreadCount(UserChatContentDto query);
	/**
	 * 获取未读 列表
	 * @param query
	 * @return
	 */
	ResultMessage queryUserChatUnreadList(UserChatContentDto query);
}
